#pragma once

#define MIN_STR			1
#define MAX_STR			255

#define	MIN_I			0
#define MAX_I			INT_MAX

#define MIN_F			0.f
#define MAX_F			4000000.f

#define MIN_DATE		20130318
#define MAX_DATE		20201231

#ifndef INT_MAX
#define INT_MAX 		2147483647
#endif /* INT_MAX */

/* Warning, Error and Critical takes an optional code parameter.
 * As 0, -1 or any other "low" default error code would prove impractical,
 * a random value, -19023, is the default code. This error code implies that
 * something went wrong, but no additional information is available.
 */
#define ERR_UNDEFINED	-19023


/* These defines defines an interface for changing the color in the command
 * line on multiple platforms.
 */
#if defined(WIN32)
	/* Windows */
	#ifndef WIN_IS_INCLUDED
		#include <Windows.h>
		#pragma warning ("HEADER INCLUDE ERROR. NEVER INCLUDE CONSTANTS.H ALONE. INCLUDE FOUNDATION.H INSTEAD.")
	#endif

	#define SET_COLOR(_C)												\
		{																\
			HANDLE __HC = GetStdHandle(STD_OUTPUT_HANDLE);				\
			SetConsoleTextAttribute(__HC, _C | FOREGROUND_INTENSITY);	\
		}

	#define GREEN				FOREGROUND_GREEN
	#define RED					FOREGROUND_RED
	#define YELLOW				GREEN | RED
	#define DEFCOLOR			GREEN | RED | FOREGROUND_BLUE
	#define	COLOR_RESTORE()		SET_COLOR(DEFCOLOR);
#else
	/* Unix */
	#define SET_COLOR(_C)		printf(_C)
	#define GREEN				"\e[0;32m"
	#define RED					"\e[0;31m"
	#define YELLOW				"\e[0;33m"
	#define DEFCOLOR			"\e[0m"
	#define	COLOR_RESTORE()		SET_COLOR(DEFCOLOR);
#endif

/* Macro for getting the lower of two inputs */
#define MIN(A,B) ((A<B) ? (A) : (B))

/* Macro for getting the higher of two inputs */
#define MAX(A,B) ((A>B) ? (A) : (B))